package com.homework;

public class Test_1 {
    public static void main(String[] args) {
        Simulator simulator = new Simulator();
        simulator. playSound(new Dog());
        simulator. playSound(new Cat());
    }
}

class Dog implements Animal{

    @Override
    public void cry() {
        System.out.println("小狗!汪汪汪");
    }

    @Override
    public String getAnimalName() {
        return "小狗";
    }
}

class Cat implements Animal{

    @Override
    public void cry() {
        System.out.println("小猫!喵喵喵");
    }

    @Override
    public String getAnimalName() {
        return "小猫";
    }
}
